home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / fsmerror.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  5KB  |  152 lines

  1. /**********************************************************************/
  2. /*               FINITE_STATE_MACHINE                                  */
  3. /*                                                                     */
  4. /*                      FSM_ERROR                                      */
  5. /*                                                                     */
  6. /*              fsm_error_or_failure procedure                         */
  7. /*                                                                     */
  8. /*  CopyRight 1995. Nicholas Poljakov all rights reserved.             */
  9. /*                                                                     */
  10. /***********************************************************************/
  11. #include <stdio.h>
  12. #include <malloc.h>
  13. #include <state1.h>
  14. #include <rcb.h>
  15. #include <string.h>
  16. int sk_r_wt(void *);
  17. int SendBlock(void *, void *);
  18. int setrc(void *, void *);
  19. int sendhsf(void *);
  20. int sendhs(void *);
  21. int sendbm(void *, void *);
  22. int sendat(void *);
  23. int rtsend(void *);
  24. unsigned long rmfmh5(void *, void *);
  25. int recwait(void *);
  26. int rcvru(void *, void *);
  27. int rcvhs(void *, void *, void *, void *);
  28. int ralloc(void *, void *);
  29. int psrm(int, void *, void *);
  30. int ps_conv(int, void *);
  31. int proterr(void *, unsigned long);
  32. int preptrcv(void *, void *);
  33. int post_rcb(void *);
  34. struct repass *postopen(void *);
  35. int phsrec(void *);
  36. int pfmh5(void *);
  37. int opndst(void *);
  38. int obtsess(void *, unsigned char);
  39. int Lrf_handler(void *);
  40. int get_sess(void *, void *);
  41. int get_attr(void *);
  42. int fsm_conv(unsigned char, unsigned char, void *);
  43. int flush (void *);
  44. int dcp(void *);
  45. int dealloc(void *);
  46. int crtp(void *);
  47. int conv(void *);
  48. int chkparm(void *, void *);
  49. int check_end(unsigned int, void *);
  50. struct rqb *call_appl(void *);
  51. int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
  52. unsigned long attltck(void *);
  53. unsigned long attacheck(void *);
  54. char *cgetmem(int, int);
  55. int sendhsf(void *);
  56. int opndst(void *);
  57. int alloc_rcb(void *, void *);
  58. int allocate(void *);
  59. int clsdst(void *);
  60.  
  61. int fsm_error(p1,p_rcb)
  62.  unsigned char p1;
  63.  struct rcb *p_rcb;
  64. {
  65.  
  66. #if OS_TYPE == 1
  67. /*********  Trace facility **********/
  68. unsigned int rtype;   /* type of record */
  69. unsigned int pnum;    /* point number */
  70. char pname[8];        /* name of module */
  71. char *drec;       /* record for dump */
  72. int  lenr;            /* record length */
  73.  
  74. rtype = INPROC;
  75. strcpy(pname, "fsmerr");
  76. pnum = 1;
  77. lenr = sizeof(struct rcb) + 1;
  78. drec = malloc(lenr);
  79. drec[0] = p1;
  80. p = drec + 1;
  81. memcpy(p, p_rcb, lenr - 1);
  82. gtf(rtype, pname, pnum, drec, lenr);
  83. free(drec);
  84. /***********************************/
  85. #endif
  86.  
  87.    switch (p1) {
  88.         case CONV_FAIL_PROTOCOL :
  89.              if((p_rcb->error_state == NO_RQS)||
  90.                 (p_rcb->error_state == RCVD_ERROR))
  91.                 {
  92.                   p_rcb->error_state = CONV_FAILURE_PROTOCOL_ERROR;
  93.                   goto ex0;
  94.                 }
  95.              else
  96.                 { goto ex_1;}
  97.         case CONV_FAIL_SON :
  98.              if((p_rcb->error_state == NO_RQS)||
  99.                 (p_rcb->error_state == RCVD_ERROR))
  100.                 {
  101.                   p_rcb->error_state = CONV_FAILURE_SON;
  102.                   goto ex0;
  103.                 }
  104.              else
  105.                 { goto ex_1;}
  106.         case Receive_error:
  107.              {
  108.                if (p_rcb->error_state == NO_RQS) {
  109.                  p_rcb->error_state = RCVD_ERROR;
  110.                  p_rcb->ps_to_hs_record = NULL;
  111.                  goto ex0;
  112.                }
  113.                if ((p_rcb->error_state == CONV_FAILURE_PROTOCOL_ERROR)||
  114.                    (p_rcb->error_state == CONV_FAILURE_SON))
  115.                      goto ex0;
  116.                else
  117.                      goto ex_1;
  118.              }
  119.         case ALLOC_FAIL_RETRY:
  120.              if(p_rcb->error_state == NO_RQS)
  121.                 {
  122.                     p_rcb->error_state = ALLOCATE_FAILURE_RETRY;
  123.                     goto ex0;
  124.                 }
  125.              else
  126.                  goto ex_1;
  127.         case ALLOC_FAIL_NO_RETRY:
  128.              if(p_rcb->error_state == NO_RQS)
  129.                 {
  130.                     p_rcb->error_state = ALLOCATE_FAILURE_NO_RETRY;
  131.                     goto ex0;
  132.                 }
  133.              else
  134.                  goto ex_1;
  135.         case SYNC_LEVEL_NOT_SUPPTD :
  136.              if(p_rcb->error_state == NO_RQS)
  137.                 {
  138.             p_rcb->error_state = SYNC_LEVEL_NOT_SUPPORTED;
  139.                     goto ex0;
  140.                 }
  141.              else
  142.                     goto ex_1;
  143.         case RESET:
  144.                 {
  145.                     p_rcb->error_state = NO_RQS;
  146.                     goto ex0 ;
  147.                 }
  148.     }
  149.  ex0: return(0);
  150.  ex_1: return(-1);
  151. }
  152.